home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / a_utils / perl / msds-prl / ptchds19.zoo / stat_t < prev    next >
Text File  |  1992-02-23  |  9KB  |  299 lines

  1. MS-DOS patches to perl.
  2. Apply this patch to the standard perl source, version 4, patch level 19,
  3. using "patch -p."  Do this in the root directory of the perl source
  4. distribution.
  5.  
  6. You can cat all these patches together and pipe the output to patch -p.
  7.  
  8. Len Reed
  9. Holos Software, Inc.
  10. ..!gatech!holos0!lbr
  11. holos0!lbr@gatech.edu
  12. --------------------------------------
  13. *** t/op/stat.t.old    Thu Nov 14 07:29:34 1991
  14. --- t/op/stat.t    Sun Feb  2 21:10:06 1992
  15. ***************
  16. *** 4,17 ****
  17.   
  18.   print "1..56\n";
  19.   
  20.   chop($cwd = `pwd`);
  21.   
  22. ! $DEV = `ls -l /dev`;
  23.   
  24. ! unlink "Op.stat.tmp";
  25. ! open(FOO, ">Op.stat.tmp");
  26.   
  27. ! $junk = `ls Op.stat.tmp`;    # hack to make Apollo update link count
  28.   
  29.   ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
  30.       $blksize,$blocks) = stat(FOO);
  31. --- 4,35 ----
  32.   
  33.   print "1..56\n";
  34.   
  35. + eval('umask');    # won't work on MS-DOS
  36. + $msdos = $@;
  37. + if ( $msdos) {
  38. +     $null_dev = 'NUL';
  39. +     $dev_dir = "$ENV{'ROOTDIR'}/bin";
  40. +     $usr_bin = $dev_dir;
  41. +     $tty = 'CON';
  42. +     $E = '.exe';
  43. + }
  44. + else {
  45. +     $null_dev = '/dev/null';
  46. +     $dev_dir = '/dev';
  47. +     $usr_bin = '/usr/bin';
  48. +     $tty = '/dev/tty';
  49. +     $E = '';
  50. + }
  51.   chop($cwd = `pwd`);
  52.   
  53. ! $DEV = `ls -l $dev_dir`;
  54.   
  55. ! unlink "Op_stat.tmp";
  56. ! open(FOO, ">Op_stat.tmp");
  57.   
  58. ! $junk = `ls Op_stat.tmp`;    # hack to make Apollo update link count
  59.   
  60.   ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
  61.       $blksize,$blocks) = stat(FOO);
  62. ***************
  63. *** 23,35 ****
  64.   
  65.   sleep 2;
  66.   
  67. ! `rm -f Op.stat.tmp2; ln Op.stat.tmp Op.stat.tmp2; chmod 644 Op.stat.tmp`;
  68.   
  69.   ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
  70. !     $blksize,$blocks) = stat('Op.stat.tmp');
  71.   
  72. ! if ($nlink == 2) {print "ok 3\n";} else {print "not ok 3\n";}
  73. ! if (($mtime && $mtime != $ctime) || $cwd =~ m#/afs/#) {
  74.       print "ok 4\n";
  75.   }
  76.   else {
  77. --- 41,53 ----
  78.   
  79.   sleep 2;
  80.   
  81. ! `rm -f Op_stat.tmp2; ln Op_stat.tmp Op_stat.tmp2; chmod 644 Op_stat.tmp`;
  82.   
  83.   ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
  84. !     $blksize,$blocks) = stat('Op_stat.tmp');
  85.   
  86. ! if ($nlink == 2 || $msdos) {print "ok 3\n";} else {print "not ok 3\n";}
  87. ! if (($mtime && $mtime != $ctime) || $msdos || $cwd =~ m#/afs/#) {
  88.       print "ok 4\n";
  89.   }
  90.   else {
  91. ***************
  92. *** 37,90 ****
  93.   }
  94.   print "#4    :$mtime: != :$ctime:\n";
  95.   
  96. ! `rm -f Op.stat.tmp`;
  97. ! `touch Op.stat.tmp`;
  98.   
  99. ! if (-z 'Op.stat.tmp') {print "ok 5\n";} else {print "not ok 5\n";}
  100. ! if (! -s 'Op.stat.tmp') {print "ok 6\n";} else {print "not ok 6\n";}
  101.   
  102. ! `echo hi >Op.stat.tmp`;
  103. ! if (! -z 'Op.stat.tmp') {print "ok 7\n";} else {print "not ok 7\n";}
  104. ! if (-s 'Op.stat.tmp') {print "ok 8\n";} else {print "not ok 8\n";}
  105.   
  106. ! unlink 'Op.stat.tmp';
  107.   $olduid = $>;        # can't test -r if uid == 0
  108. ! `echo hi >Op.stat.tmp`;
  109. ! chmod 0,'Op.stat.tmp';
  110.   eval '$> = 1;';        # so switch uid (may not be implemented)
  111. ! if (!$> || ! -r 'Op.stat.tmp') {print "ok 9\n";} else {print "not ok 9\n";}
  112. ! if (!$> || ! -w 'Op.stat.tmp') {print "ok 10\n";} else {print "not ok 10\n";}
  113.   eval '$> = $olduid;';        # switch uid back (may not be implemented)
  114.   print "# olduid=$olduid, newuid=$>\n" unless ($> == $olduid);
  115. ! if (! -x 'Op.stat.tmp') {print "ok 11\n";} else {print "not ok 11\n";}
  116.   
  117.   foreach ((12,13,14,15,16,17)) {
  118.       print "ok $_\n";        #deleted tests
  119.   }
  120.   
  121. ! chmod 0700,'Op.stat.tmp';
  122. ! if (-r 'Op.stat.tmp') {print "ok 18\n";} else {print "not ok 18\n";}
  123. ! if (-w 'Op.stat.tmp') {print "ok 19\n";} else {print "not ok 19\n";}
  124. ! if (-x 'Op.stat.tmp') {print "ok 20\n";} else {print "not ok 20\n";}
  125.   
  126. ! if (-f 'Op.stat.tmp') {print "ok 21\n";} else {print "not ok 21\n";}
  127. ! if (! -d 'Op.stat.tmp') {print "ok 22\n";} else {print "not ok 22\n";}
  128.   
  129.   if (-d '.') {print "ok 23\n";} else {print "not ok 23\n";}
  130.   if (! -f '.') {print "ok 24\n";} else {print "not ok 24\n";}
  131.   
  132. ! if (`ls -l perl` =~ /^l.*->/) {
  133. !     if (-l 'perl') {print "ok 25\n";} else {print "not ok 25\n";}
  134.   }
  135.   else {
  136.       print "ok 25\n";
  137.   }
  138.   
  139. ! if (-o 'Op.stat.tmp') {print "ok 26\n";} else {print "not ok 26\n";}
  140.   
  141. ! if (-e 'Op.stat.tmp') {print "ok 27\n";} else {print "not ok 27\n";}
  142. ! `rm -f Op.stat.tmp Op.stat.tmp2`;
  143. ! if (! -e 'Op.stat.tmp') {print "ok 28\n";} else {print "not ok 28\n";}
  144.   
  145.   if ($DEV !~ /\nc.* (\S+)\n/)
  146.       {print "ok 29\n";}
  147. --- 55,108 ----
  148.   }
  149.   print "#4    :$mtime: != :$ctime:\n";
  150.   
  151. ! `rm -f Op_stat.tmp`;
  152. ! `touch Op_stat.tmp`;
  153.   
  154. ! if (-z 'Op_stat.tmp') {print "ok 5\n";} else {print "not ok 5\n";}
  155. ! if (! -s 'Op_stat.tmp') {print "ok 6\n";} else {print "not ok 6\n";}
  156.   
  157. ! `echo hi >Op_stat.tmp`;
  158. ! if (! -z 'Op_stat.tmp') {print "ok 7\n";} else {print "not ok 7\n";}
  159. ! if (-s 'Op_stat.tmp') {print "ok 8\n";} else {print "not ok 8\n";}
  160.   
  161. ! unlink 'Op_stat.tmp';
  162.   $olduid = $>;        # can't test -r if uid == 0
  163. ! `echo hi >Op_stat.tmp`;
  164. ! chmod 0,'Op_stat.tmp';
  165.   eval '$> = 1;';        # so switch uid (may not be implemented)
  166. ! if (!$> || ! -r 'Op_stat.tmp') {print "ok 9\n";} else {print "not ok 9\n";}
  167. ! if (!$> || ! -w 'Op_stat.tmp') {print "ok 10\n";} else {print "not ok 10\n";}
  168.   eval '$> = $olduid;';        # switch uid back (may not be implemented)
  169.   print "# olduid=$olduid, newuid=$>\n" unless ($> == $olduid);
  170. ! if (! -x 'Op_stat.tmp') {print "ok 11\n";} else {print "not ok 11\n";}
  171.   
  172.   foreach ((12,13,14,15,16,17)) {
  173.       print "ok $_\n";        #deleted tests
  174.   }
  175.   
  176. ! chmod 0700,'Op_stat.tmp';
  177. ! if (-r 'Op_stat.tmp') {print "ok 18\n";} else {print "not ok 18\n";}
  178. ! if (-w 'Op_stat.tmp') {print "ok 19\n";} else {print "not ok 19\n";}
  179. ! if (-x 'Op_stat.tmp') {print "ok 20\n";} else {print "not ok 20\n";}
  180.   
  181. ! if (-f 'Op_stat.tmp') {print "ok 21\n";} else {print "not ok 21\n";}
  182. ! if (! -d 'Op_stat.tmp') {print "ok 22\n";} else {print "not ok 22\n";}
  183.   
  184.   if (-d '.') {print "ok 23\n";} else {print "not ok 23\n";}
  185.   if (! -f '.') {print "ok 24\n";} else {print "not ok 24\n";}
  186.   
  187. ! if (`ls -l perl$E` =~ /^l.*->/) {
  188. !     if (-l 'perl$E') {print "ok 25\n";} else {print "not ok 25\n";}
  189.   }
  190.   else {
  191.       print "ok 25\n";
  192.   }
  193.   
  194. ! if (-o 'Op_stat.tmp') {print "ok 26\n";} else {print "not ok 26\n";}
  195.   
  196. ! if (-e 'Op_stat.tmp') {print "ok 27\n";} else {print "not ok 27\n";}
  197. ! `rm -f Op_stat.tmp Op_stat.tmp2`;
  198. ! if (! -e 'Op_stat.tmp') {print "ok 28\n";} else {print "not ok 28\n";}
  199.   
  200.   if ($DEV !~ /\nc.* (\S+)\n/)
  201.       {print "ok 29\n";}
  202. ***************
  203. *** 112,138 ****
  204.   
  205.   $cnt = $uid = 0;
  206.   
  207. ! die "Can't run op/stat.t test 35 without pwd working" unless $cwd;
  208. ! chdir '/usr/bin' || die "Can't cd to /usr/bin";
  209. ! while (defined($_ = <*>)) {
  210. !     $cnt++;
  211. !     $uid++ if -u;
  212. !     last if $uid && $uid < $cnt;
  213.   }
  214. ! chdir $cwd || die "Can't cd back to $cwd";
  215.   
  216. ! # I suppose this is going to fail somewhere...
  217. ! if ($uid > 0 && $uid < $cnt) {print "ok 35\n";} else {print "not ok 35\n";}
  218.   
  219. ! unless (open(tty,"/dev/tty")) {
  220. !     print STDERR "Can't open /dev/tty--run t/TEST outside of make.\n";
  221.   }
  222.   if (-t tty) {print "ok 36\n";} else {print "not ok 36\n";}
  223.   if (-c tty) {print "ok 37\n";} else {print "not ok 37\n";}
  224.   close(tty);
  225.   if (! -t tty) {print "ok 38\n";} else {print "not ok 38\n";}
  226. ! open(null,"/dev/null");
  227. ! if (! -t null || -e '/xenix') {print "ok 39\n";} else {print "not ok 39\n";}
  228.   close(null);
  229.   if (-t) {print "ok 40\n";} else {print "not ok 40\n";}
  230.   
  231. --- 130,162 ----
  232.   
  233.   $cnt = $uid = 0;
  234.   
  235. ! if ($msdos) {
  236. !     print "ok 35\n";    # no setuid on MS-DOS
  237.   }
  238. ! else {
  239. !     die "Can't run op/stat.t test 35 without pwd working" unless $cwd;
  240. !     chdir $usr_bin || die "Can't cd to $usr_bin";
  241. !     while (defined($_ = <*>)) {
  242. !     $cnt++;
  243. !     $uid++ if -u;
  244. !     last if $uid && $uid < $cnt;
  245. !     }
  246. !     chdir $cwd || die "Can't cd back to $cwd";
  247.   
  248. !     # I suppose this is going to fail somewhere...
  249. !     if ($uid > 0 && $uid < $cnt) {print "ok 35\n";} else {print "not ok 35\n";}
  250. ! }
  251.   
  252. ! unless (open(tty, $tty )) {
  253. !     print STDERR "Can't open $tty--run t/TEST outside of make.\n";
  254.   }
  255.   if (-t tty) {print "ok 36\n";} else {print "not ok 36\n";}
  256.   if (-c tty) {print "ok 37\n";} else {print "not ok 37\n";}
  257.   close(tty);
  258.   if (! -t tty) {print "ok 38\n";} else {print "not ok 38\n";}
  259. ! open(null,"$null_dev");
  260. ! if (! -t null || -e '/xenix' || $msdos)
  261. !     {print "ok 39\n";} else {print "not ok 39\n";}
  262.   close(null);
  263.   if (-t) {print "ok 40\n";} else {print "not ok 40\n";}
  264.   
  265. ***************
  266. *** 141,148 ****
  267.   if (-T 'op/stat.t') {print "ok 41\n";} else {print "not ok 41\n";}
  268.   if (! -B 'op/stat.t') {print "ok 42\n";} else {print "not ok 42\n";}
  269.   
  270. ! if (-B './perl') {print "ok 43\n";} else {print "not ok 43\n";}
  271. ! if (! -T './perl') {print "ok 44\n";} else {print "not ok 44\n";}
  272.   
  273.   open(FOO,'op/stat.t');
  274.   eval { -T FOO; };
  275. --- 165,172 ----
  276.   if (-T 'op/stat.t') {print "ok 41\n";} else {print "not ok 41\n";}
  277.   if (! -B 'op/stat.t') {print "ok 42\n";} else {print "not ok 42\n";}
  278.   
  279. ! if (-B "./perl$E") {print "ok 43\n";} else {print "not ok 43\n";}
  280. ! if (! -T "./perl$E") {print "ok 44\n";} else {print "not ok 44\n";}
  281.   
  282.   open(FOO,'op/stat.t');
  283.   eval { -T FOO; };
  284. ***************
  285. *** 172,176 ****
  286.   }
  287.   close(FOO);
  288.   
  289. ! if (-T '/dev/null') {print "ok 55\n";} else {print "not ok 55\n";}
  290. ! if (-B '/dev/null') {print "ok 56\n";} else {print "not ok 56\n";}
  291. --- 196,200 ----
  292.   }
  293.   close(FOO);
  294.   
  295. ! if (-T "$null_dev") {print "ok 55\n";} else {print "not ok 55\n";}
  296. ! if (-B "$null_dev") {print "ok 56\n";} else {print "not ok 56\n";}
  297.